curl --request POST \
--url https://api.evermind.ai/api/v2/memory/context \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"user_id": "user-1",
"query": "What did I decide about the Q3 budget after the meeting with Alice?",
"top_k": 10,
"include_profile": true
}
'import requests
url = "https://api.evermind.ai/api/v2/memory/context"
payload = {
"user_id": "user-1",
"query": "What did I decide about the Q3 budget after the meeting with Alice?",
"top_k": 10,
"include_profile": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
user_id: 'user-1',
query: 'What did I decide about the Q3 budget after the meeting with Alice?',
top_k: 10,
include_profile: true
})
};
fetch('https://api.evermind.ai/api/v2/memory/context', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.evermind.ai/api/v2/memory/context",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'user_id' => 'user-1',
'query' => 'What did I decide about the Q3 budget after the meeting with Alice?',
'top_k' => 10,
'include_profile' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.evermind.ai/api/v2/memory/context"
payload := strings.NewReader("{\n \"user_id\": \"user-1\",\n \"query\": \"What did I decide about the Q3 budget after the meeting with Alice?\",\n \"top_k\": 10,\n \"include_profile\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.evermind.ai/api/v2/memory/context")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"user_id\": \"user-1\",\n \"query\": \"What did I decide about the Q3 budget after the meeting with Alice?\",\n \"top_k\": 10,\n \"include_profile\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.evermind.ai/api/v2/memory/context")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"user_id\": \"user-1\",\n \"query\": \"What did I decide about the Q3 budget after the meeting with Alice?\",\n \"top_k\": 10,\n \"include_profile\": true\n}"
response = http.request(request)
puts response.read_body{
"request_id": "<string>",
"data": {
"episodes": [
{
"id": "<string>",
"app_id": "<string>",
"project_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"summary": "<string>",
"subject": "<string>",
"episode": "<string>",
"type": "<string>",
"score": 123,
"user_id": "<string>",
"session_id": "<string>",
"sender_ids": [
"<string>"
],
"atomic_facts": [
{
"id": "<string>",
"content": "<string>",
"score": 123
}
],
"tags": [
"<string>"
],
"edited_at": "2023-11-07T05:31:56Z",
"reflect_state": "pending",
"cited": false
}
],
"profiles": [
{
"id": "<string>",
"app_id": "<string>",
"project_id": "<string>",
"user_id": "<string>",
"profile_data": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"score": 123
}
],
"agent_cases": [
{
"id": "<string>",
"app_id": "<string>",
"project_id": "<string>",
"agent_id": "<string>",
"session_id": "<string>",
"task_intent": "<string>",
"approach": "<string>",
"quality_score": 123,
"timestamp": "2023-11-07T05:31:56Z",
"score": 123,
"key_insight": "<string>"
}
],
"agent_skills": [
{
"id": "<string>",
"app_id": "<string>",
"project_id": "<string>",
"agent_id": "<string>",
"name": "<string>",
"description": "<string>",
"content": "<string>",
"confidence": 123,
"maturity_score": 123,
"score": 123,
"source_case_ids": [
"<string>"
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"unprocessed_messages": [
{
"id": "<string>",
"app_id": "<string>",
"project_id": "<string>",
"session_id": "<string>",
"sender_id": "<string>",
"role": "user",
"content": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"sender_name": "<string>",
"tool_calls": [
{
"id": "<string>",
"function": {
"name": "<string>",
"arguments": "<string>"
},
"type": "function"
}
],
"tool_call_id": "<string>"
}
]
}
}{}{}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{}{}Context Retrieval [Cloud-only]
Retrieve memories with a multi-round, LLM-driven search loop.
An LLM plans and runs several searches over the owner’s memories (keyword, semantic, hybrid, topic cluster, and reading the surrounding conversation or a whole session), looks at what came back, and searches again with new queries until it judges the evidence sufficient to answer query. The episodes it found are returned. The response contains memories, not an answer: the model’s own answer is discarded.
Use it for questions a single search answers poorly: multi-hop, temporal, or spread across several conversations. For simple lookups, /api/v2/memory/search is faster and cheaper.
Request: the same body as /api/v2/memory/search, except that user_id is required and agent_id is not accepted (422), since the loop searches one user’s memories; method is fixed to “context” (any other value is a 422); and min_score is not supported (422). Use /api/v2/memory/search for agent memories.
Response: the same SearchData shape as /api/v2/memory/search.
- The episodes found are returned in
episodes. profiles(withinclude_profile) andunprocessed_messages(with a top-levelsession_idfilter) are filled exactly as on search.episodes[].citedis true for the episodes the model named as the ones its answer rested on.episodes[].scoreis a rank-fusion score, roughly 0.01 to 0.05, plus 1.0 for a cited episode. It is not comparable with search scores.
Limits: by default at most 5 LLM rounds and 45 seconds per request. Reaching a limit is not an error: the episodes found so far are returned. Set your client timeout to at least 60 seconds.
curl --request POST \
--url https://api.evermind.ai/api/v2/memory/context \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"user_id": "user-1",
"query": "What did I decide about the Q3 budget after the meeting with Alice?",
"top_k": 10,
"include_profile": true
}
'import requests
url = "https://api.evermind.ai/api/v2/memory/context"
payload = {
"user_id": "user-1",
"query": "What did I decide about the Q3 budget after the meeting with Alice?",
"top_k": 10,
"include_profile": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
user_id: 'user-1',
query: 'What did I decide about the Q3 budget after the meeting with Alice?',
top_k: 10,
include_profile: true
})
};
fetch('https://api.evermind.ai/api/v2/memory/context', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.evermind.ai/api/v2/memory/context",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'user_id' => 'user-1',
'query' => 'What did I decide about the Q3 budget after the meeting with Alice?',
'top_k' => 10,
'include_profile' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.evermind.ai/api/v2/memory/context"
payload := strings.NewReader("{\n \"user_id\": \"user-1\",\n \"query\": \"What did I decide about the Q3 budget after the meeting with Alice?\",\n \"top_k\": 10,\n \"include_profile\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.evermind.ai/api/v2/memory/context")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"user_id\": \"user-1\",\n \"query\": \"What did I decide about the Q3 budget after the meeting with Alice?\",\n \"top_k\": 10,\n \"include_profile\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.evermind.ai/api/v2/memory/context")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"user_id\": \"user-1\",\n \"query\": \"What did I decide about the Q3 budget after the meeting with Alice?\",\n \"top_k\": 10,\n \"include_profile\": true\n}"
response = http.request(request)
puts response.read_body{
"request_id": "<string>",
"data": {
"episodes": [
{
"id": "<string>",
"app_id": "<string>",
"project_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"summary": "<string>",
"subject": "<string>",
"episode": "<string>",
"type": "<string>",
"score": 123,
"user_id": "<string>",
"session_id": "<string>",
"sender_ids": [
"<string>"
],
"atomic_facts": [
{
"id": "<string>",
"content": "<string>",
"score": 123
}
],
"tags": [
"<string>"
],
"edited_at": "2023-11-07T05:31:56Z",
"reflect_state": "pending",
"cited": false
}
],
"profiles": [
{
"id": "<string>",
"app_id": "<string>",
"project_id": "<string>",
"user_id": "<string>",
"profile_data": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"score": 123
}
],
"agent_cases": [
{
"id": "<string>",
"app_id": "<string>",
"project_id": "<string>",
"agent_id": "<string>",
"session_id": "<string>",
"task_intent": "<string>",
"approach": "<string>",
"quality_score": 123,
"timestamp": "2023-11-07T05:31:56Z",
"score": 123,
"key_insight": "<string>"
}
],
"agent_skills": [
{
"id": "<string>",
"app_id": "<string>",
"project_id": "<string>",
"agent_id": "<string>",
"name": "<string>",
"description": "<string>",
"content": "<string>",
"confidence": 123,
"maturity_score": 123,
"score": 123,
"source_case_ids": [
"<string>"
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"unprocessed_messages": [
{
"id": "<string>",
"app_id": "<string>",
"project_id": "<string>",
"session_id": "<string>",
"sender_id": "<string>",
"role": "user",
"content": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"sender_name": "<string>",
"tool_calls": [
{
"id": "<string>",
"function": {
"name": "<string>",
"arguments": "<string>"
},
"type": "function"
}
],
"tool_call_id": "<string>"
}
]
}
}{}{}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{}{}Authorizations
Body
Was this page helpful?

